package dytool.server.dytool2.controller;

import dytool.server.dytool2.dto.DyResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class AdController {

    @Value("${showAd:false}") // 设置默认值为false
    private boolean showAd;

    @PostMapping("/getReport")
    public ResponseEntity<DyResponse>  getReport(){
        DyResponse ret = new DyResponse();
        ret.setFlag(showAd); // true : dyMini Onload show Ad ; false: dyMini Onload  dont show Ad;
        ret.setMessage("a you ok ?");
        return ResponseEntity.ok(ret);
    }


    @RequestMapping("/")
    public String  defaultApi(){
        return "hello world";
    }
}
